﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using DBLayer;

namespace BALayer
{
    public class DBChuyenMon
    {
        DAL db = null;
        public DBChuyenMon()
        {
            db = new DAL();
        }
        //Lay chuyen mon
        public DataSet LayChuyenMon()
        {
            return db.ExecuteQueryDataSet("Select * From ChuyenMon", CommandType.Text, null);

        }
        //Them chuyen mon
        public bool ThemChuyenMon(ref string err, string MaGV, string MaMH)
        {
            return db.MyExecuteNonQuery("SpThemChuyenMon", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaGV", MaGV),
                new SqlParameter("@MaMH", MaMH));
        }
        //Xoa chuyen mon
        public bool XoaChuyenMon(ref string err, string MaGV, string MaMH)
        {
            return db.MyExecuteNonQuery("SpXoaChuyenMon", CommandType.StoredProcedure, ref err, 
                new SqlParameter("@MaGV", MaGV),
                new SqlParameter("@MaMH",MaMH));
        }
        //Them chuyen mon
        public bool CapNhatChuyenMon(ref string err, string MaGV, string MaMH)
        {
            return db.MyExecuteNonQuery("SpCapNhatChuyenMon", CommandType.StoredProcedure, ref err,
                new SqlParameter("@MaGV", MaGV),
                new SqlParameter("@MaMH", MaMH));
        }
    }
}
